package com.hr.mapper;

import com.hr.domain.po.Contract;
import com.hr.domain.query.ContractPageParams;
import com.hr.domain.vo.ContractVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
* @author 86150
* @description 针对表【contract(租赁合同表)】的数据库操作Mapper
* @createDate 2025-09-24 08:41:55
* @Entity com.hr.domain.po.Contract
*/
@Mapper
public interface ContractMapper {

    /**
     * 获取合同列表
     * @return List<ContractVO>
     */
    @Select("SELECT * FROM contract")
    List<ContractVO> getContractList();

    /**
     * 分页获取合同列表
     * @param queryParams
     * @return List<ContractVO>
     */
    List<ContractVO> getContractPageList(ContractPageParams queryParams);

    /**
     * 更新合同状态
     * @param id
     * @param status
     * @return int
     */
    @Update("UPDATE contract SET status = #{status} WHERE id = #{id}")
    int updateContractStatus(@Param("id") Long id,@Param("status") Integer status);

    /**
     * 获取合同详情
     * @param id
     * @return ContractVO
     */
    @Select("SELECT * FROM contract WHERE id = #{id}")
    ContractVO getContractDetail(Long id);
}




